<template>
	<view>
		<swiper duration="200" @change="change">
			<swiper-item>
				<u--form :model="form" :rules="rules" ref="form">
					<view class="information-change">
						<view class="content-view">
							<view class="content-item">
								<view class="content-item-left"><span class="required">*</span>隐患简题</view>
								<view class="content-item-right pr50">
									<u-form-item prop="hiddenDangerTitle" ref="item1">
										<u--input border="none" inputAlign="right" v-model="form.hiddenDangerTitle"
											color="#666666" fontSize="32rpx">
										</u--input>
									</u-form-item>
								</view>
							</view>
							<view class="content-item disabled" v-if="form.hiddenDangerCode">
								<view class="content-item-left ml35">隐患编号</view>
								<view class="content-item-right pr50">
									<u--input border="none" inputAlign="right" v-model="form.hiddenDangerCode"
										color="#666666" fontSize="32rpx" disabled disabledColor="#EFF2F2">
									</u--input>
								</view>
							</view>
							<view class="content-item" @click="showPopupWorkFn(3)">
								<view class="content-item-left"><span class="required">*</span>隐患所在单位</view>
								<view class="content-item-right">
									<u--input border="none" inputAlign="right" v-model="form.hiddenUnit" color="#666666"
										fontSize="32rpx" disabled disabledColor="#ffffff">
									</u--input>
									<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
									</u-icon>
								</view>
							</view>
							<view class="content-item" @click="showPicker(Level,0)">
								<view class="content-item-left"><span class="required">*</span>隐患等级</view>
								<view class="content-item-right">
									<u--input border="none" inputAlign="right" v-model="picker.hiddenDangerLevel"
										color="#666666" fontSize="32rpx" disabled disabledColor="#ffffff">
									</u--input>
									<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
									</u-icon>
								</view>
							</view>
							<view class="content-item" @click="showPicker(typeList,1)">
								<view class="content-item-left"><span class="required">*</span>隐患分类</view>
								<view class="content-item-right">
									<u--input border="none" inputAlign="right" v-model="picker.hiddenDangerType"
										color="#666666" fontSize="32rpx" disabled disabledColor="#ffffff">
									</u--input>
									<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
									</u-icon>
								</view>
							</view>
							<view class="content-item">
								<!-- @click="showPicker(bodyList,2)" -->
								<view class="content-item-left"><span class="required">*</span>隐患来源</view>
								<view class="content-item-right pr50">
									<u--input border="none" inputAlign="right" v-model="form.hiddenDangerResource"
										color="#666666" fontSize="32rpx">
									</u--input>
								</view>
							</view>
							<view class="content-item disabled">
								<view class="content-item-left"><span class="required">*</span>填报人</view>
								<view class="content-item-right pr50">
									<u--input border="none" inputAlign="right" v-model="form.informant" color="#666666"
										fontSize="32rpx" disabled disabledColor="#EFF2F2">
									</u--input>
								</view>
							</view>
							<view class="content-item disabled">
								<view class="content-item-left"><span class="required">*</span>填报人所属单位</view>
								<view class="content-item-right pr50">
									<u--input border="none" inputAlign="right" v-model="form.informantUnit"
										color="#666666" fontSize="32rpx" disabled disabledColor="#EFF2F2">
									</u--input>
								</view>
							</view>
							<view class="content-item" @click="showPopupFn(0)">
								<view class="content-item-left ml35">发现人</view>
								<view class="content-item-right">
									<u--input border="none" v-model="form.hiddenDangerFindUser" color="#666666" disabled
										disabledColor="#ffffff" inputAlign="right" fontSize="32rpx">
									</u--input>
									<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
									</u-icon>
								</view>
							</view>
							<view class="content-item" @click="showPopupWorkFn(0)">
								<view class="content-item-left ml35">发现人所属单位</view>
								<view class="content-item-right">
									<u--input border="none" v-model="form.findPeopleUnit" color="#666666"
										fontSize="32rpx" inputAlign="right" disabled disabledColor="#ffffff">
									</u--input>
									<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
									</u-icon>
								</view>
							</view>
							<view class="content-item disabled">
								<view class="content-item-left"><span class="required">*</span>填报时间</view>
								<view class="content-item-right">
									<u--input border="none" v-model="form.startDate" color="#666666" fontSize="32rpx"
										disabled disabledColor="#EFF2F2" inputAlign="right">
									</u--input>
									<image src="../../static/iconCalendar.png" class="Calendar"></image>
								</view>
							</view>
							<view class="content-item" @click="calendar(2)">
								<view class="content-item-left"><span class="required">*</span>发现日期</view>
								<view class="content-item-right">
									<u--input border="none" v-model="picker.hiddenDangerFindTime" color="#666666"
										fontSize="32rpx" disabled disabledColor="#ffffff" inputAlign="right">
									</u--input>
									<image src="../../static/iconCalendar.png" class="Calendar"></image>
								</view>
							</view>
							<view class="cont">
								<view class="content-item-left"><span class="required">*</span>隐患内容</view>
								<view class="content-item-right pr50 ml35">
									<u--textarea v-model="form.hiddenDangerContent" autoHeight></u--textarea>
								</view>
							</view>
							<view class="content-item" @click="showPopupWorkFn(1)">
								<view class="content-item-left ml35">归属职能部门</view>
								<view class="content-item-right">
									<u--input border="none" v-model="picker.belongDepType" color="#666666"
										fontSize="32rpx" disabled disabledColor="#ffffff" inputAlign="right">
									</u--input>
									<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
									</u-icon>
								</view>
							</view>
							<view class="cont">
								<view class="content-item-left ml35">相关附件</view>
								<view class="cob ml35" @click="checkAttac(form.id,'080106')">查看相关附件</view>
								<view class="content-item-right ml35">
									<files-upload :troubleId="form.id" classify="080106"></files-upload>
								</view>
							</view>
						</view>
					</view>
				</u--form>
			</swiper-item>
			<!-- <swiper-item>
				<view class="information-change">
					<view class="content-view">
						<view class="content-item" @click="showPicker(Level,4)">
							<view class="content-item-left">预评估等级</view>
							<view class="content-item-right">
								<u--input border="none" v-model="picker.planEvaluateType" color="#666666"
									fontSize="32rpx" disabled disabledColor="#ffffff">
								</u--input>
								<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
								</u-icon>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">预评估负责人</view>
							<view class="content-item-right pr50">
								<u--input border="none" v-model="form1.fAPrincipal" disabled disabledColor="#ffffff"
									color="#666666" fontSize="32rpx">
								</u--input>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">预评估审核领导</view>
							<view class="content-item-right pr50">
								<u--input border="none" v-model="form1.fAReviewLeadership" disabled
									disabledColor="#ffffff" color="#666666" fontSize="32rpx">
								</u--input>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">预评估时间</view>
							<view class="content-item-right">
								<u--input border="none" v-model="form1.fADate" color="#666666" fontSize="32rpx" disabled
									disabledColor="#ffffff">
								</u--input>
								<image src="../../static/iconCalendar.png" class="Calendar"></image>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">预评估审核时间</view>
							<view class="content-item-right">
								<u--input border="none" v-model="form1.fAReviewDate" color="#666666" fontSize="32rpx"
									disabled disabledColor="#ffffff">
								</u--input>
								<image src="../../static/iconCalendar.png" class="Calendar"></image>
							</view>
						</view>
						<view class="content-item" @click="showPicker(Level,5)">
							<view class="content-item-left">评估等级</view>
							<view class="content-item-right">
								<u--input border="none" v-model="picker.evaluateType" color="#666666" fontSize="32rpx"
									disabled disabledColor="#ffffff">
								</u--input>
								<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
								</u-icon>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">评估负责人</view>
							<view class="content-item-right pr50">
								<u--input border="none" v-model="form1.aPrincipal" color="#666666" fontSize="32rpx"
									disabled disabledColor="#ffffff">
								</u--input>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">评估审核领导</view>
							<view class="content-item-right pr50">
								<u--input border="none" v-model="form1.aReviewLeadership" color="#666666"
									fontSize="32rpx" disabled disabledColor="#ffffff">
								</u--input>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">评估时间</view>
							<view class="content-item-right">
								<u--input border="none" v-model="form1.aDate" color="#666666" fontSize="32rpx" disabled
									disabledColor="#ffffff">
								</u--input>
								<image src="../../static/iconCalendar.png" class="Calendar"></image>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">评估审核时间</view>
							<view class="content-item-right">
								<u--input border="none" v-model="form1.aReviewDate" color="#666666" fontSize="32rpx"
									disabled disabledColor="#ffffff">
								</u--input>
								<image src="../../static/iconCalendar.png" class="Calendar"></image>
							</view>
						</view>
					</view>
				</view>
			</swiper-item> -->
			<!-- <swiper-item>
				<view class="information-change">
					<view class="content-view">
						<view class="content-item" @click="showPopupFn(1)">
							<view class="content-item-left">治理责任人</view>
							<view class="content-item-right">
								<u--input border="none" v-model="form2.handleUser" color="#666666" fontSize="32rpx"
									disabled disabledColor="#ffffff">
								</u--input>
								<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
								</u-icon>
							</view>
						</view>
						<view class="content-item" @click="showPopupWorkFn(2)">
							<view class="content-item-left">治理责任单位</view>
							<view class="content-item-right">
								<u--input border="none" v-model="picker.governanceUnit" color="#666666" fontSize="32rpx"
									disabled disabledColor="#ffffff">
								</u--input>
								<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
								</u-icon>
							</view>
						</view>
						<view class="content-item" @click="calendar(7)">
							<view class="content-item-left">治理期限起始日期</view>
							<view class="content-item-right">
								<u--input border="none" v-model="picker.handleBeginDate" color="#666666"
									fontSize="32rpx" disabled disabledColor="#ffffff">
								</u--input>
								<image src="../../static/iconCalendar.png" class="Calendar"></image>
							</view>
						</view>
						<view class="content-item" @click="calendar(8)">
							<view class="content-item-left">治理期限终止日期</view>
							<view class="content-item-right">
								<u--input border="none" v-model="picker.handleEndDate" color="#666666" fontSize="32rpx"
									disabled disabledColor="#ffffff">
								</u--input>
								<image src="../../static/iconCalendar.png" class="Calendar"></image>
							</view>
						</view>
						<view class="content-item" @click="showPicker(approvalFlag,6)">
							<view class="content-item-left">是否立项</view>
							<view class="content-item-right">
								<u--input border="none" v-model="picker.approvalFlag" color="#666666" fontSize="32rpx"
									disabled disabledColor="#ffffff">
								</u--input>
								<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
								</u-icon>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">治理方案</view>
							<view class="content-item-right">
								<u--input border="none" v-model="form2.hiddenDangerContent" color="#666666" fontSize="32rpx">
								</u--input>
								<u-icon name="arrow-right" color="#333333" size="16" style="margin-left: 10rpx;">
								</u-icon>
							</view>
						</view>
						<view class="cont">
							<view class="content-item-left">治理方案附件</view>
							<view class="cob" @click="checkAttac(form.id,'080105')">查看相关附件</view>
							<view class="content-item-right">
								<files-upload :troubleId="form.id" classify="080105"></files-upload>
							</view>
						</view>
						<view class="content-item">
							<view class="content-item-left">治理计划资金(万元)</view>
							<view class="content-item-right">
								<u--input border="none" v-model="form2.costMoney" color="#666666" fontSize="32rpx">
								</u--input>
							</view>
						</view>
						<view class="btn-view">
							<view class="login-btn but1" @click="goback">取消</view>
							<view class="login-btn but2" @click="save">保存</view>
						</view>
					</view>
				</view>
			</swiper-item> -->
		</swiper>
		<view class="maintenance">
			<view class="btn-view">
				<view class="login-btn but1" @click="goback">取消</view>
				<view class="login-btn but2" @click="save">保存</view>
			</view>
			<!-- <u-steps :current="current" activeIcon="checkmark" inactiveIcon="arrow-right">
				<u-steps-item title="基本信息">
					<text :class="current >= 0 ?'slot-icon slot-xz':'slot-icon slot-wxz'" slot="icon">1</text>
				</u-steps-item>
				<u-steps-item title="评估信息">
					<text :class="current >= 1 ?'slot-icon slot-xz':'slot-icon slot-wxz'" slot="icon">2</text>
				</u-steps-item>
				<u-steps-item title="治理信息">
					<text :class="current >= 2 ?'slot-icon slot-xz':'slot-icon slot-wxz'" slot="icon">3</text>
				</u-steps-item>
			</u-steps> -->
		</view>
		<changeWork :show="showPopupWork" :selfFlag="selfFlag" :wbFlag="wbFlag" @showPopup="showPopupWork=false" @listItem="listItemWork"></changeWork>
		<optionCard :show="showPopup" @showPopup="showPopup=false" @listItem="listItem"></optionCard>
		<u-calendar :show="show" mode="single" @close="show=false" @confirm="confirm" monthNum="14"
			:defaultDate="defaultDateMultiple" :minDate="minDate" :maxDate="maxDate"></u-calendar>
		<u-picker :show="show1" :columns="columns" keyName="label" @confirm="sub" @cancel="show1=false"></u-picker>
	</view>
</template>

<script>
	import optionCard from "./components/option-card.vue"
	import changeWork from "./components/change-work.vue"
	const d = new Date()
	const year = d.getFullYear()
	let month = d.getMonth() + 1
	month = month < 10 ? `0${month}` : month
	let date = d.getDate() + 0
	date = date < 10 ? `0${date}` : date
	export default {
		components: {
			optionCard,
			changeWork
		},
		data() {
			return {
				wbFlag:'',
				selfFlag:'1',
				rules: {
					'hiddenDangerTitle': {
						type: 'string',
						required: true,
						message: '请填写隐患简题',
						trigger: ['blur', 'change']
					},
				},
				//表单一
				form: {
					id: '', //ID
					hiddenDangerTitle: '', //隐患简题
					hiddenDangerCode: '', //隐患编号
					hiddenUnit: '', //隐患所在单位
					hiddenUnitId:'',
					hiddenDangerLevel: '', //隐患等级
					hiddenDangerType: '', //隐患类型
					hiddenDangerResource: '', //隐患来源
					informant: '', //填报人
					informantUnit: '', //填报人单位
					hiddenDangerFindUser: '', //发现人
					hiddenDangerFindUserId: '', //发现人ID
					findPeopleUnit: '', //发现人单位
					startDate: '', //填报时间
					hiddenDangerFindTime: '', //发现时间
					hiddenDangerContent: '', //隐患内容
					belongDepType: '', //归属职能部门
					annex: '' //隐患报告
				},
				form1: {
					planEvaluateType: '', //预评估等级
					fAPrincipal: '', //预评估负责人
					fAReviewLeadership: '', //预评估审核领导
					fADate: '', //预评估时间
					fAReviewDate: '', //预评估审核时间
					evaluateType: '', //评估等级
					aPrincipal: '', //评估负责人
					aReviewLeadership: '', //评估审核领导
					aDate: '', //评估时间
					aReviewDate: '' //评估审核时间
				},
				form2: {
					governanceUnit: '', //治理责任单位
					handleUnitId: '', //治理责任单位ID
					handleUser: '', //治理责任人
					handleUserId: '', //治理责任人ID
					handleBeginDate: '', //治理期限起始日期
					handleEndDate: '', //治理期限终止日期
					approvalFlag: '', //是否立项
					hiddenDangerContent: '', //治理方案
					hiddenDangerContentAnnex: '', //治理方案附件
					costMoney: '', //治理计划资金(万元)
				},
				columns: [
					[]
				], //下拉框数据
				columnsIndex: 0, //下拉框复制下标
				typeList: [
					[]
				], //隐患类型下拉框
				bodyList: [
					[]
				], //隐患来源下拉框
				departmentList: [
					[]
				], //归属职能部门下拉框
				Level: [
					[]
				], //级别
				governanceUnit: [
					[]
				], //责任单位
				approvalFlag: [
					[{
						label: '是',
						id: true
					}, {
						label: '否',
						id: false
					}]
				], //是否立项
				minDate: '', //最小时间
				maxDate: '', //最大时间
				defaultDateMultiple: [`${year}-${month}-${date}`], //默认时间
				dataType: '', //保养时间类型
				show: false, //日期选择显示
				show1: false, //下拉框显示
				showPopup: false, //显示选人弹框
				showPopupWork: false, //显示工作单位
				popupIndex1: 0, //选人弹框下标，0发现人，1治理责任人
				popupIndex2: 0, //选择部门弹窗下标，0发现人单位，1治理人单位
				current: 0, //三个页面滑动下标
				picker: {
					hiddenDangerFindTime: '',
					handleBeginDate: '',
					handleEndDate: '',
					hiddenDangerType: '',
					hiddenDangerLevel: '',
					hiddenDangerResource: '',
					belongDepType: '',
					planEvaluateType: '',
					evaluateType: '',
					governanceUnit: '',
					approvalFlag: ''
				},
				noExceptionList: {} //
			}
		},
		onLoad(e) {
			if (e.noExceptionList) {
				console.log(e.noExceptionList)
				let noExceptionList = JSON.parse(e.noExceptionList)
				this.noExceptionList = noExceptionList
				this.form.hiddenDangerCode = noExceptionList.fmQrCode
			}
			// #ifdef APP-PLUS
			// var page = this.$mp.page.$getAppWebview();
			// page.setStyle({
			// 	popGesture: 'none'
			// });
			// #endif
		},
		created() {
			this.getDictsByCode()
			this.startDate() //填报时间回显
			this.createdID()
		},
		methods: {
			createdID() {
				this.form.id = this.guid()
			},
			//保存
			async save() {
				let flag = true
				let formObj = {
					...this.form,
					// ...this.form1,
					// ...this.form2
				}
				let obj = {
					id: formObj.id,
					hiddenDangerTitle: formObj.hiddenDangerTitle,
					hiddenDangerLevel: formObj.hiddenDangerLevel,
					hiddenDangerResource: formObj.hiddenDangerResource,
					hiddenDangerType: formObj.hiddenDangerType,
					hiddenDangerFindUserId: formObj.hiddenDangerFindUserId,
					hiddenDangerFindTime: formObj.hiddenDangerFindTime,
					hiddenDangerContent: formObj.hiddenDangerContent,
				}
				obj.hiddenDangerFindTime > (new Date()*1) ? flag = false : ''
				for (let k in obj) { //循环校验必填项是否填写
					if (obj[k] == '') {
						flag = false
					}
				}
				if (flag) {
					let {
						resultValue: res
					} = await this.request(this.$api.addHiddenDangerInfo, formObj, 'POST')
					if (this.form.hiddenDangerCode) {
						this.noExceptionList.linkId = res
						this.noExceptionList.result = false
						let res1 = await this.request(this.$api.saveFmHiddenDangerCheck, this.noExceptionList, 'POST')
						if (res1.code == 200) {
							uni.showToast({
								icon: 'success',
								title: '添加隐患成功'
							})
							setTimeout(() => {
								uni.navigateBack({
									delta: 1
								})
							}, 1500)
						}
					} else {
						uni.showToast({
							icon: 'success',
							title: '添加隐患成功'
						})
						setTimeout(() => {
							uni.navigateBack({
								delta: 1
							})
						}, 1500)
					}
				} else {
					if (obj.hiddenDangerFindTime > new Date()*1) {
						uni.showToast({
							icon: 'none',
							title: '发现时间不能大于今天时间'
						})
					} else {
						uni.showToast({
							icon: 'none',
							title: '请确认必填项是否填写'
						})
					}

				}
			},
			//选择框
			sub(e) {
				console.log(e.value[0])
				if (this.columnsIndex == 0) {
					this.form.hiddenDangerLevel = e.value[0].id
					this.picker.hiddenDangerLevel = e.value[0].label
				} else if (this.columnsIndex == 1) {
					this.form.hiddenDangerType = e.value[0].id
					this.picker.hiddenDangerType = e.value[0].label
				} else if (this.columnsIndex == 2) {
					this.form.hiddenDangerResource = e.value[0].id
					this.picker.hiddenDangerResource = e.value[0].label
				} else if (this.columnsIndex == 3) {
					this.form.belongDepType = e.value[0].id
					this.picker.belongDepType = e.value[0].label
				} else if (this.columnsIndex == 4) {
					this.form1.planEvaluateType = e.value[0].id
					this.picker.planEvaluateType = e.value[0].label
				} else if (this.columnsIndex == 5) {
					this.form1.planEvaluateType = e.value[0].id
					this.picker.planEvaluateType = e.value[0].label
					this.form1.evaluateType = e.value[0].id
					this.picker.evaluateType = e.value[0].label
				} else if (this.columnsIndex == 6) {
					this.form2.approvalFlag = e.value[0].id
					this.picker.approvalFlag = e.value[0].label
				}
				this.show1 = false
			},
			//回显默认数据
			startDate() {
				let user = uni.getStorageSync('userInfo');
				let startDate = this.defaultDateMultiple[0]
				console.log('默认时间：', startDate)
				console.log('用户信息：', user)
				this.picker.hiddenDangerFindTime = startDate
				this.form.hiddenDangerFindTime = new Date(startDate).getTime()
				this.form.hiddenDangerFindUserId = user.userId
				this.form.hiddenUnit = user.deptName
				this.form.hiddenUnitId = user.deptId
				this.form.informant = user.userName
				this.form.hiddenDangerFindUser = user.userName
				this.form.findPeopleUnit = user.deptName
				this.form.informantUnit = user.unitName
				this.form.startDate = startDate
				this.form1.fAPrincipal = user.userName
				this.form1.fAReviewLeadership = user.userName
				this.form1.aPrincipal = user.userName
				this.form1.aReviewLeadership = user.userName
				this.form1.fADate = startDate
				this.form1.fAReviewDate = startDate
				this.form1.aDate = startDate
				this.form1.aReviewDate = startDate
			},
			//日期选择
			confirm(e) {
				if (e[0]) {
					let dateNum = new Date(e[0]).getTime()
					if (this.dataType == 2) {
						this.picker.hiddenDangerFindTime = e[0]
						this.form.hiddenDangerFindTime = dateNum
					} else if (this.dataType == 7) {
						this.picker.handleBeginDate = e[0]
						this.form2.handleBeginDate = dateNum
					} else if (this.dataType == 8) {
						this.picker.handleEndDate = e[0]
						this.form2.handleEndDate = dateNum
					}
					this.show = false
					this.defaultDateMultiple[0] = e[0]
				} else {
					let dateNum = new Date(this.defaultDateMultiple[0]).getTime()
					if (this.dataType == 2) {
						this.picker.hiddenDangerFindTime = this.defaultDateMultiple[0]
						this.form.hiddenDangerFindTime = dateNum
					} else if (this.dataType == 7) {
						this.picker.handleBeginDate = this.defaultDateMultiple[0]
						this.form2.handleBeginDate = dateNum
					} else if (this.dataType == 8) {
						this.picker.handleEndDate = this.defaultDateMultiple[0]
						this.form2.handleEndDate = dateNum
					}
					this.show = false
				}
			},
			//下拉框赋值
			async getDictsByCode() {
				let data = {}
				let arr = []
				data = {
					typeCode: "YHZY"
				} // 隐患类型下拉框
				let {
					resultValue: res
				} = await this.request(this.$api.getDictsByCode, data, "POST")
				// console.log('字典查询', res.items)
				res.items.forEach((item) => {
					this.typeList[0].push({
						label: item.dicName,
						id: item.dicCode
					})
				})
				data = {
					typeCode: "YH_GSZNBM"
				}; //归属职能部门下拉框
				let {
					resultValue: res1
				} = await this.request(this.$api.getDictsByCode, data, "POST")
				// console.log('字典查询', res1.items)
				res1.items.forEach((item) => {
					this.departmentList[0].push({
						label: item.dicName,
						id: item.dicCode
					})
				})
				data = {
					typeCode: "YHLY"
				}; //隐患来源下拉框
				let {
					resultValue: res2
				} = await this.request(this.$api.getDictsByCode, data, "POST")
				// console.log('字典查询', res2.items)
				res2.items.forEach((item) => {
					this.bodyList[0].push({
						label: item.dicName,
						id: item.dicCode
					})
				})
				data = {
					typeCode: "PGDJ"
				}; //隐患等级下拉框
				let {
					resultValue: res3
				} = await this.request(this.$api.getDictsByCode, data, "POST")
				// console.log('字典查询', res3.items)
				res3.items.forEach((item) => {
					this.Level[0].push({
						label: item.dicName,
						id: item.dicCode
					})
				})
			},
			//显示下拉框
			showPicker(e, index) {
				this.columns = e
				this.columnsIndex = index
				this.show1 = true
			},
			// 点击显示日期组件
			calendar(e) {
				// this.maxDate = `${year}-${month+12}-${date+30}`
				this.minDate = `${year-1}-${month}-${date}`
				this.dataType = e
				this.show = true
			},
			//选择人弹框回调
			listItem(e) {
				console.log(e)
				if (this.popupIndex1 == 0) {
					this.form.hiddenDangerFindUser = e.userName //发现人
					this.form.hiddenDangerFindUserId = e.id //发现人ID
				} else {
					this.form2.handleUser = e.userName //治理责任人
					this.form2.handleUserId = e.id //治理责任人ID
				}
			},
			//单位弹窗回调
			listItemWork(e) {
				console.log(e)
				if (this.popupIndex2 == 0) {
					this.form.findPeopleUnit = e.orgName //发现人单位
				} else if(this.popupIndex2 == 1) {
					this.picker.belongDepType = e.orgPath //职能专属部门单位
					this.form.belongDepType = e.orgPath //职能专属部门单位ID
				}else{
					this.form.hiddenUnit = e.orgName //隐患所在单位ID
					this.form.hiddenUnitId = e.id //隐患所在单位ID
				}
			},
			//显示填报人弹窗
			showPopupWorkFn(e) {
				console.log('e',e)
				if(e==3){
					this.selfFlag = ''
					this.wbFlag = '0'
				}else{
					this.selfFlag='1'
					this.wbFlag = ''
				}
				this.popupIndex2 = e
				this.showPopupWork = true
			},
			//显示填报人弹窗
			showPopupFn(e) {
				this.popupIndex1 = e
				this.showPopup = true
			},
			//取消按钮
			goback() {
				uni.navigateBack()
			},
			// 页面滑动
			change(e) {
				this.current = e.detail.current
			},
			//预览
			checkAttac(id, classify) {
				uni.navigateTo({
					url: './../checkTheAttachment/checkTheAttachment?classify=' + classify + '&connectId=' + id
				})
			}
		}
	}
</script>

<style scoped>
	.information-change {
		min-height: 100vh;
		background: #F5F6F9;
		box-sizing: border-box;
		padding-bottom: 100rpx;
	}

	.content-view {
		background: white;
	}

	.content-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 28rpx 40rpx;
		padding-left: 20rpx;
		border-bottom: 2rpx solid #F5F5F5;
	}

	.cont {
		padding: 28rpx 40rpx;
		padding-left: 20rpx;
		border-bottom: 2rpx solid #F5F5F5;
	}

	.content-item-left {
		font-size: 32rpx;
		color: #333333;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		width: 280rpx;
	}

	.content-item-right {
		display: flex;
		flex: 1;
		font-size: 32rpx;
		color: #999;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
	}

	>>>.uni-input-input {
		text-align: right;
	}

	.password-desc {
		font-size: 28rpx;
		color: #999;
		padding: 28rpx 40rpx 0;
	}

	.btn-view {
		width: 100%;
		display: flex;
		justify-content: space-between;
		padding: 30rpx 0;
	}

	.btn-view .btn {
		height: 96rpx;
		border-radius: 8rpx;
	}

	.login-btn {
		box-sizing: border-box;
		width: 320rpx;
		height: 80rpx;
		line-height: 80rpx;
		font-size: 32rpx;
		font-family: PingFangSC-Medium, PingFang SC;
		font-weight: 500;
		text-align: center;
		border-radius: 14rpx;
	}

	.but1 {
		border: 1px solid #3473F9;
		color: #3473F9;
	}

	.but2 {
		background-color: #3473F9;
		color: #FFFFFF;
	}

	.Calendar {
		margin-left: 10rpx;
		width: 44rpx;
		height: 44rpx;
	}

	.pdf {
		margin-top: 30rpx;
		width: 120rpx;
		height: 120rpx;
		background-size: 100%;
		background-repeat: no-repeat;
	}

	.maintenance {
		background-color: #FFFFFF;
		position: fixed;
		bottom: 0;
		height: 228rpx;
		width: 100%;
		box-shadow: 0 -1px 11px 0 rgba(0, 0, 0, 0.09);
		text-align: center;
		padding: 40rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-around;
	}

	swiper {
		background: #F5F6F9;
		min-height: 100vh !important;
	}

	swiper-item {
		height: calc(100vh - 228rpx) !important;
		overflow: auto !important;
	}

	>>>uni-swiper {
		background: #F5F6F9;
		min-height: 100vh !important;
	}

	>>>uni-swiper-item {
		height: calc(100vh - 228rpx) !important;
		overflow: auto !important;
	}

	>>>.u-border {
		border: none !important;
	}

	>>>.u-textarea {
		padding: 20rpx 0;
	}

	.slot-icon {
		width: 60rpx;
		height: 60rpx;
		border-radius: 50%;
		font-size: 28rpx;
		line-height: 60rpx;
		text-align: center;
		box-sizing: border-box;
	}

	.slot-xz {
		background-color: #3473F9;
		color: #fff;
	}

	.slot-wxz {
		border: 1px solid #969799;
		color: #969799;
	}

	>>>.u-text__value--main {
		color: #3473F9 !important;
	}

	>>>.u-form-item__body {
		padding: 0 !important;
	}

	>>>.u-form-item__body__right__message {
		text-align: right !important;
	}

	.cob {
		flex: 1;
		font-size: 28rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #3473F9;
	}
</style>
